<?php
class Eleve
{
	private $_id;
	private $_nom;
	private $_prenom;
	private $_datenaissance;
	private $_password;
	private $_idRefClasse;
	
	public function __construct()
	{
		if(func_num_args() == 1)
		$this->hydrate(func_get_arg(0));
	}
	
	public function id() { return $this->_id; }
	public function nom() { return $this->_nom; }
	public function prenom() { return $this->_prenom; }
	public function datenaissance() { return $this->_datenaissance; }
	public function password() { return $this->_password; }
	public function idRefClasse() { return $this->_idRefClasse; }
	
	public function hydrate(array $donnees)
	{
		foreach ($donnees as $key => $value)
		{
			$method = 'set'.ucfirst($key);
		
			if (method_exists($this, $method))
			{
				$this->$method($value);
			}
		}
	}
	
	public function setId($id)
	{
		$this->_id = $id;
	}
	
	public function setNom($nom)
	{
		$this->_nom = $nom;
	}
	
	public function setPrenom($prenom)
	{
		$this->_prenom = $prenom;
	}
	
	public function setDatenaissance($datenaissance)
	{
		$this->_datenaissance = $datenaissance;
	}
	
	public function setPassword($password)
	{
		$this->_password = $password;
	}
	
	public function setIdRefClasse($idRefClasse)
	{
		$this->_idRefClasse = $idRefClasse;
	}
}
?>